package com.mianyang.zhangsan.common.factory;

import com.mianyang.zhangsan.common.util.OperationManHelper;
import com.mianyang.zhangsan.common.util.StringUtils;
import com.mianyang.zhangsan.exception.SecServiceException;
import com.mianyang.zhangsan.model.entity.SecPaper;
import com.mianyang.zhangsan.model.entity.SecTemplate;

import java.util.Date;

public class PaperFactory {

    public static SecPaper createByTemplate(SecTemplate template) {
        return SecPaper.builder()
                .paperType(template.getPaperType())
                .paperScore(template.getPaperScore())
                .problems(template.getProblems())
                .limitTime(template.getLimitTime())
                .winScore(template.getWinScore())
                .accountId(OperationManHelper.getAccountId())
                .accountName(OperationManHelper.getAccountName())
                .templateId(template.getTemplateId())
                .createTime(new Date())
                .build();
    }
}
